import os
import sys

# 分割字符串，以便后续IP遍历
def splitIpStr(startip,endip):
    ipList = []
    ipList.append( startip.split('.') )
    ipList.append( endip.split('.') )
    return ipList

# 获取CPU的核心数,为后续开启线程池做预备
def getCpuCoreCount():
    return os.cpu_count()

# 判断操作系统类型,返回值为nt为WIN，posix为类UNIX
def getOS():
    return os.name

# 开始扫描存活主机
def pingLiveHosts(host):
    osName = getOS()
    if osName == "nt":
        if(os.system('ping -n 2 -w 300 ' + host ) == 0):
            print(host +' is ok')
        else:
            print(host + ' fail')

# 生成IP
def ipForAll(startip, endip):
    return 0


if __name__ == '__main__':
    if len(sys.argv) <= 2:
        print('input [startip] [endip]')
        sys.exit()
    startip = sys.argv[1]
    endip = sys.argv[2]
    print(splitIpStr(startip,endip))
    
    
